import csv
import random
import sys, os
import time
import datetime
import pdb

start_words = {}
word_dic = {}
word_list = []

def init():
    global word_dic, word_list
    
    f = open("data2.csv")
    reader = csv.reader(f)
    for word, meaning, level, numquestion, numwrong in reader:
        word = word.upper()
        word_dic[word] = (meaning, int(level), int(numquestion), int(numwrong))
        word_list.append(word)

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print "argument more! [src] [dst]"
        sys.exit(0)

    init()
    f_src = open(sys.argv[1])
    f_dst = open(sys.argv[2], "w")
    count = 1
    words = f_src.read().split()
    for word in words:
        f_dst.write("%d. %s %s\n"%(count, word, word_dic[word][0]))
        count += 1
    
    f_src.close()
    f_dst.close()
    os.system( sys.argv[2] )
